# Contributor: Olliver Schinagl <oliver@schinagl.nl>
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname=openv2g
pkgver=0.9.4
pkgrel=1
pkgdesc="Implements ISO IEC 15118 and also the DIN 70121 vehicle to grid (V2G) communication interface"
url="https://openv2g.org/"
arch="all"
license="LGPL-3.0-or-later"
options="!check" # No tests available
subpackages="lib$pkgname:libs $pkgname-dev"
source="
	0001-Enable-XMLDSIG-codec-support.patch
	0002-Violate-the-spec-less-by-downgrading-to-ASCII-for-UT.patch
	makefiles.patch
	$pkgname-$pkgver.zip::https://downloads.sourceforge.net/sourceforge/openv2g/OpenV2G_$pkgver.zip
"

unpack() {
	mkdir -p "$builddir"
	unzip "$srcdir/$pkgname-$pkgver.zip" -d "$builddir"
	# To ensure patches can be applied, convert the \r\n code-base first.
	find "$builddir" -type f -exec dos2unix '{}' \;
}

build() {
	cd Release
	make
}

package() {
	depends="lib$pkgname"
	cd Release
	make DESTDIR="$pkgdir/usr" install
}

sha512sums="a445b77e0870ac6f0bb5b419e862de7eaffc1da1421bffd267ea06c976b869d70111179dc54a373f0c28f6bdae83629cbc6e45c68ec03b571692a631b6436c67  0001-Enable-XMLDSIG-codec-support.patch
fd2ee6c2a223e462f2142b16d1887b2a43e2c0c4e30cb40569d04dd116c83581e75d1867244691ac2b9f0ea21eb453a6df85fc4d9378154f4772f07648b792e7  0002-Violate-the-spec-less-by-downgrading-to-ASCII-for-UT.patch
5c4e8df3033a9ebed412a004efdb812528e3d7c7e8d126dc1a1139c106391eeba58a7b13f88a21d4addd176b6f65dee3d1e2243cb46177628c5dd2b6e3f59f33  makefiles.patch
0fe088bc3ae0f0dc6af8c9c3a989301e5e155a9406b80cb9025ceb5b548dc94202dde37993711c589fac6eddf626897c7ef003b73e01cb1c5b20b7b73365b930  openv2g-0.9.4.zip"
